package com.kly.sc.api.application.service.trade;

import com.fqgj.base.services.redis.RedisClient;
import com.fqgj.common.api.Response;
import com.kly.dto.ProductDto;
import com.kly.sc.api.application.service.utils.BaseComponent;
import com.kly.service.ProductService;
import com.kly.service.UserVasPurchasesService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class PaidFeaturesService {
    @Resource
    UserVasPurchasesService userVasPurchasesService;
    @Resource
    ProductService productService;

    @Resource
    RedisClient redisClient;

    @Resource
    BaseComponent baseComponent;

    public Response saveUserPurchasesBenefits(String userCode, ProductDto product){
        ProductDto productDto = baseComponent.getProductDto(product.getProductCode());
        if (productDto!=null){
           return userVasPurchasesService.saveUserPurchasesBenefits(userCode,productDto);

        }else {
            return Response.error("This product information does not exist");
        }

    }
}
